package org.wtframework.website.server.model.impl;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;
import org.openredhead.springx.core.server.model.IBasicObject;
import org.openredhead.springx.core.server.model.ICompositorObject;

@Entity
@Proxy(lazy = true)
@DynamicInsert(value = true)
@DynamicUpdate(value = true)
@Table(name = "nzsz_website_notice_board")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class NoticeBoard implements IBasicObject, ICompositorObject<Integer> {
	
	private static final long serialVersionUID = -6280233944146657288L;

	private Integer id;
	
	private Integer orderId;
	
	private String title; //标题
	
	private Integer issueStatus; //发布状态，1为发布
	
	private Integer isTop; //是否置顶，1为置顶
	
	private Date submiTime;//提交时间
	
	private Date pusTime; //发布时间
	
	private String publisher; //发布人
	
	private String content; //内容
	
	private Long pageViews;//阅读量
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "issue_status")
	public Integer getIssueStatus() {
		return issueStatus;
	}

	public void setIssueStatus(Integer issueStatus) {
		this.issueStatus = issueStatus;
	}

	@Column(name = "is_top")
	public Integer getIsTop() {
		return isTop;
	}

	public void setIsTop(Integer isTop) {
		this.isTop = isTop;
	}
	
	@Column(name = "submit_time")
	public Date getSubmiTime() {
		return submiTime;
	}

	
	public void setSubmiTime(Date submiTime) {
		this.submiTime = submiTime;
	}

	@Column(name = "pus_time")
	public Date getPusTime() {
		return pusTime;
	}

	public void setPusTime(Date pusTime) {
		this.pusTime = pusTime;
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	@Column(columnDefinition = "text")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	@Override
	public int hashCode() {

		return (getId() != null ? getId().hashCode() : 0);

	}

	@Column(name = "order_id")
	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Override
	public boolean equals(Object o) {

		if (o == null) return false;

		if (!(o instanceof NoticeBoard)) return false;

		final NoticeBoard instance = (NoticeBoard) o;

		if (getId() != null ? !getId().equals(instance.getId()) : instance.getId() != null) return false;

		return true;

	}

	@Column(name = "page_views")
	public Long getPageViews() {
		return pageViews;
	}

	public void setPageViews(Long pageViews) {
		this.pageViews = pageViews;
	}

}
